package com.ylxn.elasticsearch;

import org.apache.http.HttpHost;
import org.apache.http.protocol.HTTP;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.IOException;

/**
 * @author: coll man
 * @create: 2021-05-17 09:36
 */
public class es_client {
    public static void main(String[] args) throws IOException {
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200, "http"))
        );
        System.out.println(client);
        //关闭es客户端
        client.close();
    }
}
